***** RUN DO_MASTER.do ***** do "$Do_files\DO_MASTER.do"

global program "OA_TableB37"
cap log close
cap log using "$Log_files\log_$program$today", replace

**** REPLICATION OF TABLE B.3.7 ****

clear all
set mem 2g
set more off

// Import data

use $Data\data_news_voting, clear

// Get controls

global ctrl_base	"sh_lde lpop_A sh_F sh_F_new sh_cspsup sh_sec sh_ter lmean_reink lmean_reink2 charact_altitude charact_altitude_std sh_active sh_young sh_prot sh_M mk com_property"
global ctrl_plus	"mean_votation lcrSR_F_N"

global fe			"charact_agglo"
global fe_iv		"I_charact_agglo_*"
global cluster		"charact_agglo"

// Column 1
		
reghdfe oui instr_dev_mk  /// 		
	$ctrl_plus ///
	$ctrl_base ///
	if sample_hq00dstr==1, ///
	absorb($fe) cluster($cluster) keepsing
estimates store RF_base

// Column 2

cap drop rape
g rape=a190_dev_mk
reghdfe oui rape  /// 		
	$ctrl_plus ///
	$ctrl_base ///
	if sample_hq00dstr==1, ///
	absorb($fe) cluster($cluster) keepsing
estimates store RF_a190

// Column 3

cap drop rape
g rape=c190_dev_mk
reghdfe oui rape  /// 		
	$ctrl_plus ///
	$ctrl_base ///
	if sample_hq00dstr==1, ///
	absorb($fe) cluster($cluster) keepsing
estimates store RF_c190

// Column 4

cap drop rape
g rape=a187_dev_mk
reghdfe oui rape  /// 		
	$ctrl_plus ///
	$ctrl_base ///
	if sample_hq00dstr==1, ///
	absorb($fe) cluster($cluster) keepsing
estimates store RF_a187

// Column 5

cap drop rape
g rape=c187_dev_mk
reghdfe oui rape  /// 		
	$ctrl_plus ///
	$ctrl_base ///
	if sample_hq00dstr==1, ///
	absorb($fe) cluster($cluster) keepsing
estimates store RF_c187

// Labels

la var instr_dev_mk 		"HQ $ \mathtt{CPD} $ Deviation (Baseline)"
la var rape 				"[0.1em] HQ $ \mathtt{CPD} $ Deviation (Violent crime \& rape)"
la var lcrSR_F_N 			"[0.1em] Local $ \mathtt{CPD} $"
la var mean_votation 		"[0.1em] Past Vote Outcomes"

// Table
	
estout RF_base RF_a190 RF_c190 RF_a187 RF_c187 ///
	using "$Results\\$program.tex", replace style(tex) type label	///
	cells(b(star fmt(%9.3f)) se(par fmt(%9.3f)))  ///
	stats(N r2_a, lab("Observations" "Adjusted $ R^2 $") fmt(0 3)) ///
	collabels(none) ///
	mlabels(, span none prefix(\multicolumn{@span}{c}{) suffix(})) ///
	msign(--) starlevels($^c$ .1 $^b$ .05 $^a$ .01) ///
	keep(instr_dev_mk rape mean_votation lcrSR_F_N) /// 
	order(instr_dev_mk rape lcrSR_F_N mean_votation) ///	
	title(News and voting: Reduced-form estimates when adding sexual assaults) ///	
	prehead("\begin{table}[!h]" ///
	"\begin{center}" ///
	"\begin{threeparttable}" ///
	"\begin{footnotesize}" ///
	"\caption{\small{@title}\label{$program}}" ///
	"\begin{tabular*}{\columnwidth}{@{\extracolsep{\stretch{1}}}l*{@M}{c}@{}}" ///
	"\hline" "\hline" ///	
	"\\" ///
	"Specification 								&\multicolumn{5}{c}{Reduced-Form Estimation} \\" ///
	"											\cmidrule(lr){2-6}	" ///
	"Dependent Variable 						&\multicolumn{5}{c}{Minaret Ban approval (\%Yes)} \\" ///
	"											\cmidrule(lr){2-6}" ///
	"$ \mathtt{\Delta HQC} $ Construction		&\multicolumn{1}{c}{Violent}	&\multicolumn{2}{c}{Violent Crime,} 	&\multicolumn{2}{c}{Violent Crime, Rape,} \\" ///
	"											&\multicolumn{1}{c}{Crime}			&\multicolumn{2}{c}{Rape} 					&\multicolumn{2}{c}{Sex. acts w/ child} \\" ///
	"											\cmidrule(lr){2-2}				\cmidrule(lr){3-4} 						\cmidrule(lr){5-6}" ///
	"Sample										&\multicolumn{1}{c}{All}		&\multicolumn{1}{c}{All} 	&\multicolumn{1}{c}{No couples} 	&\multicolumn{1}{c}{All} 	&\multicolumn{1}{c}{No couples} \\" ///
	"											\cmidrule(lr){2-2}	\cmidrule(lr){3-3} 	\cmidrule(lr){4-4} 	\cmidrule(lr){5-5} 	\cmidrule(lr){6-6}" ///
	"											&\multicolumn{1}{c}{(1)} 	&\multicolumn{1}{c}{(2)}  	&\multicolumn{1}{c}{(3)} &\multicolumn{1}{c}{(4)} &\multicolumn{1}{c}{(5)}\\") ///
	posthead("\hline" ///
	"\\") ///
	prefoot("\\" ///
	"\hline") ///
	postfoot("\hline" "\hline" ///
	"\end{tabular*}" /// 
	"\end{footnotesize}" ///
	"\begin{tablenotes}[normal,flushleft]" ///
	"\begin{scriptsize}" ///
	"\item \emph{Notes}:" /// 
	"The unit of observation is a municipality. " ///
	"Standard errors clustered at agglomeration level in parentheses. " ///
	"{$^c$} significant at 10\%; {$^b$} significant at 5\%; {$^a$} significant at 1\%. " ///
	"Column (1) is the baseline reduced-form estimation. " ///
	"Columns (2) and (3) are the reduced-form estimations when including HQ rape (art. 190). " ///
	"Columns (4) and (5) are the reduced-form estimations when including HQ rape (art. 190) and sexual acts with children (art. 187). " ///
	"All regressions include the full vector of controls of Table \ref{Main_Table2}. " ///
	"" ///
	"\end{scriptsize}" ///
	"\end{tablenotes}" ///
	"\end{threeparttable}" ///
	"\end{center}" ///
	"\end{table}")

cap log close
